package com.cyq.day14.game;

public class Monster {
    int hp;
    int atk;
    int def;
    String name;

    public Monster() {
    }

    public Monster(int hp, int atk, int def, String name) {
        this.hp = hp;
        this.atk = atk;
        this.def = def;
        this.name = name;
    }
    public void fight(Hero h){
        h.injured(this);
    }
    public void injured(Hero h){
        System.out.println("英雄攻击！");
        int damage=h.atk-this.def;
        this.hp-=damage;
        System.out.println("怪物还剩"+this.hp);
    }
}
